#define FUSE_USE_VERSION 31

#include <myFs/adaptor.h>
#include <spdlog/spdlog.h>

using FuseAdaptor = ::adaptor::fuse::Adaptor;
using SimpleFS    = ::myFs::basic::SimpleFS;

/// myfs fuse 接口
static const struct fuse_operations myfs_oper = {
    .getattr = FuseAdaptor::getattr,
    .mknod   = FuseAdaptor::mknod,
    .mkdir   = FuseAdaptor::mkdir,
    .unlink  = FuseAdaptor::unlink,
    .rmdir   = FuseAdaptor::rmdir,
    .rename  = FuseAdaptor::rename,
    .open    = FuseAdaptor::open,
    .read    = FuseAdaptor::read,
    .write   = FuseAdaptor::write,
    .statfs  = FuseAdaptor::statfs,
    .readdir = FuseAdaptor::readdir,
};

int main(int argc, char *argv[]) {
    spdlog::set_level(spdlog::level::trace);
    SimpleFS myfs{};          ///< myfs配置与初始化
    FuseAdaptor::init(myfs);  ///< fuse适配器初始化
    spdlog::info("Simple fs start run\n");
    return fuse_main(argc, argv, &myfs_oper, NULL);
}
